package mamikeji.liaowa.widget;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;

import mamikeji.liaowa.R;

/**
 * Created by 廉冲-android开发 on 2017/5/20.
 * 封装弹框
 */
public abstract class ForDialog extends Dialog implements
        View.OnClickListener {
    /**
     * 布局文件
     */
    public int layoutResID;
    public Context context;
    public View mView;

    public ForDialog(Context context, int layoutResID) {
        super(context, R.style.DialogLoading);
        this.context = context;
        this.layoutResID = layoutResID;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setBackgroundDrawableResource(android.R.color.transparent);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(layoutResID);
        mView = LayoutInflater.from(context).inflate(layoutResID, null);
        setCanceledOnTouchOutside(false);
        Window w = getWindow();
        w.setWindowAnimations(R.style.PopupAnimation);
        init();
    }

    /**
     * @author xc
     * @date 2016-3-31 下午2:43:15
     * @describe 初始化控件和填充数据
     */
    public abstract void init();

}